<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,initial-scale=1.0,width=device-width" />
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>分享海报</title>
    <link rel="stylesheet" type="text/css" href="../../../css/aui/aui.css" />
    <style>
        #app {
            height: 100vh;
            display: flex;
            flex-direction: column;
            /*padding: 8rem 0 2.5rem 0;*/
        }

        .imgWrap {
            flex: 1;
            background: url('../../../image/img/qishi_bg1.png') no-repeat center center;
            background-size: cover;
            color: #fff;
            display: flex;
            flex-direction: column;
            justify-content: space-between;
            padding: 4rem 0;
        }

        .jindutiao {
            width: 100%;
            display: block;
            margin: 0 auto;
        }

        .erweima {
            width: 50%;
            display: block;
            margin: 0 auto;
        }

        .biaoyu {
            width: 100%;
            display: block;
            margin: 0 auto;
        }

        .btn {
            width: 5rem;
            height: 1.6rem;
            background: rgba(255, 255, 255, 0.7);
            color: #0689FB;
            line-height: 1.6rem;
            border-radius: 0.3rem;
            text-align: center;
            margin: 0 auto;
        }

        .userInfo {
            height: 6rem;
            background: #fff;
            display: flex;
            justify-content: center;
            align-items: center;
        }

        .headimgurl {
            width: 3.5rem;
            height: 3.5rem;
            margin-right: 0.5rem;
            border-radius: 50%;
            overflow: hidden;
            border: 1px solid #eee;
        }

        .headimgurl img {
            width: 3.5rem;
            height: 3.5rem;
            border-radius: 50%;
        }

        .code {
            color: #0689FB;
            font-size: 0.6rem;
        }

        .fanhui {
            position: absolute;
            left: 1rem;
            top: 2.5rem;
            background: rgba(0, 0, 0, 0);
            color: #fff;
        }
    </style>
</head>

<body>
    <div id="app">
        <div class="aui-pull-left fanhui " onclick="close_w()">
            <span class="aui-iconfont aui-icon-left"></span>返回
        </div>
        <div class="imgWrap">
            <img class="jindutiao" src="../../../image/my/jindutiao.png" alt="">
            <img class="erweima" :src="qrcode" alt="">
            <img class="biaoyu" src="../../../image/my/biaoyu.png" alt="">
            <div class="saveBtn">
                <div class="btn" @click="savePhoto()">保存到相册</div>
            </div>
        </div>
        <div class="userInfo">
            <div class="headimgurl">
                <img v-if="userInfo.headimgurl" :src="userInfo.headimgurl" onerror='this.src="../../../image/icon/menu03.png"' alt="">
                <img v-else src="../../../image/portrait.png" alt="">
            </div>
            <div>
                <div class="aui-margin-b-10">{{userInfo.nickname}}</div>
                <div class="code">邀请码：{{userInfo.user_tel}}</div>
            </div>
        </div>
    </div>
</body>
<script src="../../../script/api.js" charset="utf-8"></script>
<script src="../../../script/common/jquery-3.3.1.min.js" charset="utf-8"></script>
<script src="../../../script/common/common.js" charset="utf-8"></script>
<script src="../../../script/common/config.js" charset="utf-8"></script>
<script src="../../../script/common/vue.min.js" charset="utf-8"></script>

<script>
    apiready = function() {
        api.parseTapmode();
        vm.init();
    }

    var vm = new Vue({
        el: "#app",
        data: {
            userInfo: {},
            qrcode: ''
        },
        methods: {
            init() {
                this.userInfo = get_local("userInfo");
                this.getQrcode();
            },
            getQrcode() {
                var that = this;
                _ajax(Config.api.HomeQrcode, {}, function(ret) {
                    if (ret.code === 200) {
                        that.qrcode = ret.data.qrcode_url;
                    }
                });
            },
            savePhoto() {
                $('.fanhui').html('&nbsp;');
                $('.saveBtn').html('&nbsp;');
                setTimeout(function() {
                    var screenClip = api.require('screenClip');
                    screenClip.screenShot({
                        album: true,
                    }, function(ret, err) {
                        if (ret.status) {
                            $('.fanhui').html('<span class="aui-iconfont aui-icon-left"></span>返回');
                            $('.saveBtn').html('<div class="btn" onclick="vm.savePhoto()">保存到相册</div>');
                            api.toast({
                                msg: '保存成功'
                            });
                        }
                    });
                }, 200);

            }
        }
    });
</script>

</html>
